package com.beiing.tianshuai.tianshuai.mine.ui;

import android.content.Intent;
import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.ImageButton;

import com.beiing.tianshuai.tianshuai.R;
import com.beiing.tianshuai.tianshuai.base.BaseActivity;
import com.beiing.tianshuai.tianshuai.mine.ui.fragment.FansAndIdolFragment;
import com.flyco.tablayout.SegmentTabLayout;

import java.util.ArrayList;

import butterknife.BindView;

public class FansAndIdolActivity extends BaseActivity {

    @BindView(R.id.toolbar_btn_back)
    ImageButton mToolbarBack;
    @BindView(R.id.toolbar_st_idol_or_fans)
    SegmentTabLayout mToolbarStIdolOrFans;

    public static final String []tabTitles = {"关注", "粉丝"};

    @Override
    protected int getLayoutId() {
        return R.layout.activity_fans_and_idol;
    }

    @Override
    protected void init() {
        Intent intent = getIntent();
        String toUid = intent.getStringExtra("toUid");
        int currentTab = intent.getIntExtra("currentTab", 0);
        ArrayList<Fragment> fragments = new ArrayList<>();
        FansAndIdolFragment idolFragment = FansAndIdolFragment.newInstance(0, toUid);
        FansAndIdolFragment fansFragment = FansAndIdolFragment.newInstance(1, toUid);
        fragments.add(idolFragment);
        fragments.add(fansFragment);
        mToolbarStIdolOrFans.setTabData(tabTitles, this, R.id.fl_fragment_container, fragments);
        mToolbarStIdolOrFans.setCurrentTab(currentTab);

        mToolbarBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }
}
